<template>
  <div>
    <audio ref="audio1" :src="medias.audio1" style="display:none"  preload></audio>
    <audio ref="audio2" :src="medias.audio2" style="display:none"  preload></audio>
  </div>
</template>

<script>
import resources from '@/assets/js/resources'

export default {
  data () {
    return {
      medias: resources.medias
    }
  },
  mounted () {
    let { audio1, audio2 } = this.$refs
    document.addEventListener('WeixinJSBridgeReady', () => {
      audio1.play()
      audio2.play()
      setTimeout(() => {
        audio1.pause()
        audio2.pause()
      }, 0)
    })
  },
  methods: {
    play (type) {
      this.$refs['audio' + type].play()
    }
  }
}
</script>
